<template>
    <div class="global">

        <el-card class="card">
            <img src="../assets/ceshi.png" alt="" srcset="" style="width: 50px;height: 50px;border-radius: 50%;">
            
                    <div class="item">
                      用户名:{{userinfo.username}}
                    </div>
                    <div class="item">
                      电话： {{userinfo.phone}}
                    </div>
                    <div class="item">
                      邮箱： {{userinfo.email}}
                    </div>

            
        </el-card>
    </div>
</template>
<style>
.item{
    width: 100%;
    margin: 20px 0px;
}
</style>
<script setup>
import service from '@/utils/request';
import { onMounted, ref } from 'vue';
const form = ref({
  
})
const userinfo=ref({})
const token=ref("")
onMounted(()=>{
 
  if(window.localStorage.getItem("userinfo")){
    token.value=(JSON.parse(window.localStorage.getItem("userinfo"))).token
    getuserinfo()
  }
})
const  getuserinfo=async ()=>{
  const res=await service.get("/api/admin/info",{
    // params:{
    //   token:token.value
    // }
  })
  userinfo.value=res.data.userInfo
  window.localStorage.setItem("user",JSON.stringify(userinfo.value))
  console.log(res)
}
</script>
<style scoped>
.card {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.global {
    width: 100%;
    height: 100%;

}
</style>